﻿#region Copyright
/// <copyright>
/// Copyright (c) 2008 Ilia Shramko.
/// Released under the terms of the GNU General Public License.
/// </copyright>
#endregion

using System;
using System.Collections.Generic;
using System.Text;

namespace Osh.Media
{
	public class MediaAttribute
	{
		private MediaAttributeNames _name;
		private bool _isReadOnly = false;
		private object _value;

		public MediaAttribute(MediaAttributeNames name, object value)
		{
			_name = name;
			_value = value;
		}

		public MediaAttributeNames Name
		{
			get { return _name; }
		}

		public bool IsReadOnly
		{
			get { return _isReadOnly; }
			protected set { _isReadOnly = value; }
		}

		public virtual object Value
		{
			get { return _value; }
			set
			{
				if(_isReadOnly)
					throw new InvalidOperationException(string.Format("Property '{0}' is readonly.", _name));
				_value = value;
			}
		}
	}
}
